package com.df.ez_game.server.logic.module.equip;

import com.df.ez_game.EZGameCtx;
import com.df.ez_game.business.annotation.EzController;
import com.df.ez_game.business.annotation.EzMapping;
import com.df.ez_game.server.logic.module.CmdDefine;
import com.df.ez_game.server.logic.module.equip.entity.WearEquipReq;
import com.df.ez_game.server.logic.module.equip.entity.WearEquipResp;
import com.df.ez_game.server.logic.rpc.buy.OrderRpc;

import java.util.ArrayList;
import java.util.List;

@EzController(id= CmdDefine.Equip,desc = "装备系统")
public class EquipController {

    //穿戴
    @EzMapping(id = 1,desc = "穿戴装备")
    public WearEquipResp wearEquip(WearEquipReq equipReq){

        EZGameCtx context = EZGameCtx.getContext();
        int cmd = context.getReqMsg().getCmd();
        int ver = context.getReqMsg().getVer();
        System.out.println("穿装备,ver:"+ver+"  cmd:"+cmd);
        //TODO 请求和返回值可以放入对象池，减少频繁创建对象带来的开销
        OrderRpc rpc = context.getRpc(OrderRpc.class);
        boolean order = rpc.createOrder(1L);
        return new WearEquipResp().setHole(equipReq.getHole()).setEquipId(equipReq.getEquipId());
    }
    //卸下
    @EzMapping(id = 2,desc = "卸下装备")
    public WearEquipResp downEquip(Integer equipId){
        return null;
    }
    @EzMapping(id = 3,desc = "无返回值")
    //升级
    private void noReturn(Integer equipId){

    }
    @EzMapping(id = 5,desc = "无参数无返回值")
    private void noParamAndReturn(){

    }
    @EzMapping(id = 6,desc = "参数是intlist")
    private void paramIntList(List<Integer> ids){

    }

    @EzMapping(id = 7,desc = "参数是对象list")
    private void paramObjList(List<WearEquipReq> ids){

    }

    @EzMapping(id = 8,desc = "返回值是对象list")
    private List<WearEquipReq> returnObjList(){
        return new ArrayList<>();
    }

    @EzMapping(id = 9,desc = "返回值是对象list")
    private List<Integer> returnIntList(){
        return new ArrayList<>();
    }
}
